package com.jerry.controller;

import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.*;
import org.springframework.stereotype.Component;

/**
 * Created by Shirly on 2016/8/18.
 */

public class LogIntercept {
    @Pointcut("execution(public * com.jerry.controller..*.*(..))")
    public void recordLog(){}

    @Before("recordLog()")
    public void before() {
        this.printLog("已经记录下操作before 方法执行前");
    }

    @Around("recordLog()")
    public void around(ProceedingJoinPoint pjp) throws Throwable{
        this.printLog("已经记录下操作日志around 方法执行前");
       // pjp.proceed();
        this.printLog("已经记录下操作日志around 方法执行后");
    }

    @After("recordLog()")
    public void after() {
        this.printLog("已经记录下操作日志after 方法执行后");
    }

    private void printLog(String str){
        System.out.println(str);
    }
}
